<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    事件委托是当子元素需要频繁绑定事件时，让其父元素去处理。
    <ul id="list">
        <li>aaa</li>
        <li>bbb</li>
        <li>ccc</li>
    </ul>
    <script>

        const eleList=document.querySelector('#list');
        const eleListItems=document.querySelectorAll('#list li')
        console.log(eleListItems)
        eleList.addEventListener('click',function(e){
            console.log('父元素')
        })
        eleListItems.forEach((item)=>{
            item.addEventListener('click',function(e){
            console.log('子元素')
        })
        })

        // 事件委托
        function addEventDelegate(){

        }
    </script>
</body>
</html>